<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
    <style>
        .box{
            width: 100px;
            height: 100px;
            background-color: red;
        }
    </style>
</head>
<body>
    <div id="app">
        <div class="box" v-show="flag"></div>
        <button @click="sub">点击</button>
    </div>
    <script>
        new Vue({
            el:"#app",
            data:{
                flag:true,
            },
            methods:{
                sub(){
                    this.flag=!this.flag;
                    console.log(this.flag);
                }
            }
        })
    </script>
</body>
</html>